package com.middlegroup.pay;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.middlegroup.common.enums.AlikeyEnums;
import com.middlegroup.pay.dto.AliReturnQueryOrderResponse;
import com.middlegroup.pay.service.AlipayService;

@RunWith(SpringRunner.class)
@SpringBootTest
public class testAes {

	@Autowired
	private AlipayService alipayService;
	
	@org.junit.Test
    public void apiTest(){
		//TODO 支付宝H5支付
	    AliReturnQueryOrderResponse aliReturnQueryOrderResponse = alipayService.AlipayQuery("8a399971525b43449b31b958bcc8c3ed", "1f4868bda6e7438a90bda9e547e2d0e3");
	    
	    if(aliReturnQueryOrderResponse != null && AlikeyEnums.NO_TRANS.getCode().equals(aliReturnQueryOrderResponse.getAlipay_trade_query_response().getCode()) 
        		&& (null == aliReturnQueryOrderResponse.getAlipay_trade_query_response().getTrade_status() || "null".equals(aliReturnQueryOrderResponse.getAlipay_trade_query_response().getTrade_status()) )){
        	System.out.println(2);
        }
	    System.out.println(null == aliReturnQueryOrderResponse.getAlipay_trade_query_response().getTrade_no() ? "" : aliReturnQueryOrderResponse.getAlipay_trade_query_response().getTrade_no());
	    System.out.println("aliReturnQueryOrderResponse"+aliReturnQueryOrderResponse);
	}
	
}
